function [accu_ave,accu_cross,conf_mat,conf_sum]=calculateaccu(cross_val)
file_dir=dir('Data_exp/MFC');

for i=1:length(file_dir)-2
    calltype{i}=file_dir(i+2).name;
end
conf_sum=zeros(length(calltype),length(calltype));
for j=1:cross_val
fid=fopen(['result' num2str(j) '.mlf']);
x=textscan(fid,'%s');
status=fclose(fid);
corr=0;
conf_mat{j}=zeros(length(calltype),length(calltype));

for i=0:(length(x{1})-1)/6-1
    input=x{1}{2+6*i};
    ind_temp=find(input=='_');
    input_name=input(4:ind_temp-1);
    output=x{1}{5+6*i};
    xloc=strmatch(input_name,calltype,'exact');
    yloc=strmatch(output,calltype,'exact');
    conf_mat{j}(xloc,yloc)=conf_mat{j}(xloc,yloc)+1;
end
accu_cross(j)=sum(diag(conf_mat{j}))/((length(x{1})-1)/6);
conf_sum=conf_sum+conf_mat{j};
end

accu_ave=sum(diag(conf_sum))/sum(sum(conf_sum));

